package com.qdxwx.models.order;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 课程订单
 * @author developer
 */
public class Order implements Serializable {

    private static final long serialVersionUID = 7687324559966427231L;
    /**
     * 订单ID
     */
    protected int orderId;
    /**
     * 订单号
     */
    protected String orderNo;
    /**
     * 订单类型 COURSE课程 MEMBER会员
     */
    protected String orderType;
    /**
     * 订单原始金额
     */
    protected Integer orderAmount;
    /**
     * 优惠券编码id
     */
    protected Long couponCodeId = 0L;
    /**
     * 优惠券金额
     */
    protected Integer couponAmount;//优惠券金额
    /**
     * 订单要支付的金额（优惠后要支付的金额）
     */
    protected Integer payAmount;

    protected Integer cashAmount;//现金实际支付的金额
    protected Integer vmAmount;//vm账户实际支付的金额
    protected Integer backAmount;//返现账户实际支付的金额

    protected Integer refundAmount;//退款金额

    protected String imgUrl;

    protected String description;//备用描述

    protected Long version = 0L;//乐观锁版本号
    /**
     * 支付类型 ALIPAY支付宝  FREE免费赠送,后台赠送
     */
    protected String payType;
    /**
     * 订单支付时间
     */
    @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime payTime;

    protected String outTradeNo;//第三方支付商户订单号
    /**
     * 请求渠道(WEB,APP)
     */
    protected String reqChannel;
    protected String reqIp;//客户端IP

    /**
     * 订单状态  SUCCESS已支付 INIT未支付 CANCEL已取消
     */
    protected String status;

    /**
     * 配送地址Id
     */
    protected int addressId;

    /**
     * 购买用户ID
     */
    protected Long userId;
    /**
     * 用户姓名
     */
    protected String userName;
    //机构Id
    protected Integer companyId;
    /**
     * 后台审核用户ID
     */
    protected Integer managerId;

    protected String managerName;

    /**
     * 订单创建时间
     */
    @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime createTime;

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    public Integer getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(Integer payAmount) {
        this.payAmount = payAmount;
    }

    public Integer getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(Integer orderAmount) {
        this.orderAmount = orderAmount;
    }

    public Integer getCashAmount() {
        return cashAmount;
    }

    public void setCashAmount(Integer cashAmount) {
        this.cashAmount = cashAmount;
    }

    public Integer getVmAmount() {
        return vmAmount;
    }

    public void setVmAmount(Integer vmAmount) {
        this.vmAmount = vmAmount;
    }

    public Integer getBackAmount() {
        return backAmount;
    }

    public void setBackAmount(Integer backAmount) {
        this.backAmount = backAmount;
    }

    public Integer getCouponAmount() {
        return couponAmount;
    }

    public void setCouponAmount(Integer couponAmount) {
        this.couponAmount = couponAmount;
    }

    public Long getCouponCodeId() {
        return couponCodeId;
    }

    public void setCouponCodeId(Long couponCodeId) {
        this.couponCodeId = couponCodeId;
    }

    public Integer getRefundAmount() {
        return refundAmount;
    }

    public void setRefundAmount(Integer refundAmount) {
        this.refundAmount = refundAmount;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public LocalDateTime getPayTime() {
        return payTime;
    }

    public void setPayTime(LocalDateTime payTime) {
        this.payTime = payTime;
    }

    public String getReqChannel() {
        return reqChannel;
    }

    public void setReqChannel(String reqChannel) {
        this.reqChannel = reqChannel;
    }

    public String getReqIp() {
        return reqIp;
    }

    public void setReqIp(String reqIp) {
        this.reqIp = reqIp;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Integer companyId) {
        this.companyId = companyId;
    }

    public Integer getManagerId() {
        return managerId;
    }

    public void setManagerId(Integer managerId) {
        this.managerId = managerId;
    }

    public String getManagerName() {
        return managerName;
    }

    public void setManagerName(String managerName) {
        this.managerName = managerName;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public int getAddressId() {
        return addressId;
    }

    public void setAddressId(int addressId) {
        this.addressId = addressId;
    }

    @Override
    public String toString() {
        return "Order{" +
                "orderId=" + orderId +
                ", orderNo='" + orderNo + '\'' +
                ", orderType='" + orderType + '\'' +
                ", payAmount=" + payAmount +
                ", orderAmount=" + orderAmount +
                ", cashAmount=" + cashAmount +
                ", vmAmount=" + vmAmount +
                ", imgUrl=" + imgUrl +
                ", backAmount=" + backAmount +
                ", couponAmount=" + couponAmount +
                ", couponCodeId=" + couponCodeId +
                ", refundAmount=" + refundAmount +
                ", outTradeNo='" + outTradeNo + '\'' +
                ", description='" + description + '\'' +
                ", version=" + version +
                ", payType='" + payType + '\'' +
                ", payTime=" + payTime +
                ", reqChannel='" + reqChannel + '\'' +
                ", reqIp='" + reqIp + '\'' +
                ", status='" + status + '\'' +
                ", addressId='" + addressId + '\'' +
                ", userId=" + userId +
                ", userName='" + userName + '\'' +
                ", managerId=" + managerId +
                ", managerName='" + managerName + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
